#define _CRT_SECURE_NO_WARNINGS 1

struct ListNode* swapPairs(struct ListNode* head) {
    if (head == NULL || head->next == NULL)
    {
        return head;
    }
    struct ListNode* pcur = head;
    struct ListNode* pnext = head->next;

    pcur->next = pnext->next;
    pnext->next = pcur;
    head = pnext;
    while (pcur->next && pcur->next->next)
    {
        struct ListNode* prev = pcur;
        pcur = pcur->next;
        pnext = pcur->next;
        pcur->next = pnext->next;
        pnext->next = pcur;
        prev->next = pnext;
    }
    return head;
}